*****************************************************************************
*			          Figure Additional Context CHES	       				*
*																			*			
* Author: 			Valentina Gonzalez Rostani		        				*
* Contact: 			mag384@pitt.edu              							*
* Date: 			August 9 2024   										*
* Version:			Stata 17 												*                                                                          
*																			*
*****************************************************************************
/*
This do-file:
- Creates Figure A4 using data from CHES. 

Input:
- Data\1999-2019_CHES_dataset_means(v3).dta

Output:
- Figure A4: Number of Radical Right Parties in the Party System [Figures\NewParty.pdf]

*/

*Defining Directory
cd "C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication"

*Calling the data
use "Data\1999-2019_CHES_dataset_means(v3).dta", clear 

*******************************************************************************
* Preparing variables
*******************************************************************************
{
gen radright=1 if family==1
replace radright=0 if family>1
}
******************************************************************************
* Graph
******************************************************************************
* Graph style 
{
grstyle clear
set scheme s2color
grstyle init
grstyle set plain, box
grstyle color background white
grstyle set color dknavy
grstyle yesno draw_major_hgrid yes
grstyle yesno draw_major_ygrid yes
grstyle color major_grid gs8
grstyle linepattern major_grid dot
grstyle color ci_area gs12%50
 graph set window fontface "Georgia"
}
// Figure A4: Number of Radical Right Parties in the Party System
{
preserve
collapse (sum) radright, by(year)  // Collapse the data by summing the 'radright' variable for each year

line radright year, ytitle("Number of Radical Right Parties", size(small))   xtitle("Year", size(small))  
graph export "Figure\NewParty.pdf", as(pdf) replace

restore
}